package com.spirng.leetcode.day10;

public class Test494 {
    public int findTargetSumWays(int[] nums, int target) {
        int sum=0;
        for (int i = 0; i < nums.length; i++) {
             sum+=nums[i];
        }
        if((sum+target)%2!=0){
            return 0;
        }
        int left=(sum+target)/2;
        int []dp=new int[left+1];
        for (int i = 0; i < nums.length; i++) {
            for (int j = target; j > nums[i]; j--) {
                dp[j]=Math.max(dp[j],dp[j-nums[i]]+nums[i]);
            }
        }
        return 0;
    }
}
